home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
windows
/
cm95_10.zip
/
INTERNET.DLL
/
TEXT
/
WILAGENT
next >
Wrap
Text File
|
1996-10-29
|
3KB
|
143 lines
AddExtender ("WXSock32i.dll")
IntControl (35, 500, 0, 0, 0)
bOK = @TRUE
sDial = "<dialupname>"
nMaxRedials= <numredials>
nRedialDelay = 10
sPgmPath = "<pgmpath>"
sPgmDir = "<pgmdir>"
bNewHdrs = <newhdrs>
bSendMail = <sendmail>
;bGetMail = <getmail>
bNewGroups = <newgroups>
bCompact = <compact>
sErrDesc = ""
nWait = 10 ; How many minutes to wait for Agent to finish its work
;Dial our host (unless user is on a direct connect)...
hConn = 0
nNumRedials = 0
;if ((bGetMail || bSendMail) && sDial <> "")
if (bSendMail && sDial <> "")
:DialIt
hConn = DUNConnect (sDial)
nErr = SGetLastErr ()
if (!hConn)
switch nErr
case @SErrNotFound
sErrDesc = "Couldn't connect to %sDial%: no such dial-up"
break
case @SErrBusy
if (nNumRedials <= nMaxRedial)
nNumRedials = nNumRedials + 1
Delay (nRedialDelay)
goto DialIt
else
sErrDesc = "Couldn't connect to %sDial%: Line busy"
endif
break
case @SErrNoAnswer
if (nNumRedials <= nMaxRedial)
nNumRedials = nNumRedials + 1
Delay (nRedialDelay)
goto DialIt
else
sErrDesc = "Couldn't connect to %sDial%: No answer"
endif
break
case @SErrVoice
sErrDesc = "Couldn't connect to %sDial%: A human answered"
break
case nErr ; <--default
sErrDesc = "Couldn't connect to %sDial% - error %nErr%"
endswitch
bOK = @FALSE
goto LogIt
else
if (nErr == @SAlready)
; We're already connected. Don't hang up when this event is thru...
hConn = 0
endif
endif
endif
; Run Agent & make it do things...
sTitle = ""
if (WinExist ("Free Agent")) then sTitle = "Free Agent"
if (WinExist ("Agent")) then sTitle = "Agent"
if (sTitle <> "")
WinActivate (sTitle)
else
DirChange (sPgmDir)
Run (sPgmPath, "")
delay (6)
if (WinExist ("Free Agent")) then sTitle = "Free Agent"
if (WinExist ("Agent")) then sTitle = "Agent"
endif
; Get new headers (if chosen)...
if (bNewHdrs)
SendKeysTo (sTitle, "!on")
Delay (10)
endif
; Update the group list (if chosen)...
if (bNewGroups)
SendKeysTo (sTitle, "!og")
Delay (10)
endif
; Get new mail (if chosen)...
;if (bGetMail)
; SendKeysTo (sTitle, "???")
; Delay (10)
;endif
; Send outgoing mail/articles (if chosen)...
if (bSendMail)
SendKeysTo (sTitle, "!op")
Delay (10)
endif
; Compact the database (if chosen)...
;if (bCompact)
; SendKeysTo (sTitle, "!fc")
;endif
; Wait for nWait minutes, or till user kills off Agent manually...
for n=1 to nWait * 6
if (WinExist (sTitle))
Delay (10)
MouseMove (100+n, 100, "", "")
endif
next n
; If user hit Ctrl+Break, WIL will bring us here...
:Cancel
; Hang up...
:HangUp
if (hConn)
nRet = DUNDisconnect (hConn)
endif
; Log what we did...
:LogIt
if bOK == @TRUE
sLog = "Ran Agent"
else
sLog = strcat ("Error attempting to automate Agent:", @CRLF, sErrDesc)
endif
CMLogMessage (sLog)
Display (8, "ClockMan95", sLog)
exit
~